<script>
export default {
  name: "m"
}
</script>

<template>
<h1>EL——消息提示组件</h1>
  <el-button @click="f(type=1)">成功消息</el-button>
  <el-button @click="f(type=2)">警告消息</el-button>
  <el-button @click="f(type=3)">错误消息</el-button>
  <el-button @click="f(type=4)">普通消息</el-button>
  <el-button @click="f(type=4)">可关闭的消息</el-button>
</template>
<script setup>
import {ElMessage}  from "element-plus";
const f = (type) => {
  switch (type) {
    case 1:ElMessage.success("成功消息");break;
    case 2:ElMessage.warning("警告消息");break;
    case 3:ElMessage.error("错误消息");break;
    case 4:ElMessage.info("普通消息");break;
    case 5:ElMessage.closeAll();break;
  }
}
</script>
<style scoped>

</style>